<?php
/**
 * PC 端 头部公共控制器
 * headercontroller.php
 * 
 * Create on 
 * Create by Jim.Chou
 */
namespace haibao\cms\business\control\pc\common;

class HeaderController extends \haibao\cms\business\control\Base{
	
	public function __construct($updateTime = null,$controlId,$isPublish){
		parent::__construct($updateTime,$controlId,$isPublish);
	}
	
	
	/**
	 * 获取模版内容
	 * @param : String $content
	 */
	public function displayTemplateHtml(){

		$isNew = 0;
		$controlData = $this->getParameter(self::$CONTROL_DATA);
		$content = $this->getParameter(self::$CONTROL_CONTENT);
		$path = $this->generateHtmlPath(__CLASS__);
		$parameters = array();
		if($controlData['auto']){
			
			$temp = array();
			foreach($controlData['auto'] as $data){
				$parameterValue = json_decode($data['ParameterValue']);
				array_push($parameters,$parameterValue);
			}
		}
		if($controlData['manual'] && isset($controlData['manual']['nowon'])){
			$this->setParameter('order',$controlData['manual']['nowon']);
		}

		if($controlData['manual'] && isset($controlData['manual']['isNew'])){
			$isNew = $controlData['manual']['isNew'];
		}
		$this->setParameter('parameters', $parameters);
		$this->assign('parameters', $this->getParameter('parameters'));
		$this->assign('isNew', $isNew);
		$this->assign('brandsHost', \haibao\classlibrary\www\Config::getConfig(\haibao\classlibrary\www\Config::CLASSLIBRARY_CONFIG_HOST_BRANDS));
		$this->assign('starsHost', \haibao\classlibrary\www\Config::getConfig(\haibao\classlibrary\www\Config::CLASSLIBRARY_CONFIG_HOST_STARS));
		$this->assign('designersHost', \haibao\classlibrary\www\Config::getConfig(\haibao\classlibrary\www\Config::CLASSLIBRARY_CONFIG_HOST_DESIGNER));
		$this->assign('productHost', \haibao\classlibrary\www\Config::getConfig(\haibao\classlibrary\www\Config::CLASSLIBRARY_CONFIG_HOST_BRANDS).'/product/');
		$this->assign('fashionistaHost', \haibao\classlibrary\www\Config::getConfig(\haibao\classlibrary\www\Config::CLASSLIBRARY_CONFIG_HOST_BOZHU));
		$this->assign('tvHost', \haibao\classlibrary\www\Config::getConfig(\haibao\classlibrary\www\Config::CLASSLIBRARY_CONFIG_TV_HOST));
		$this->assign('sayHost', \haibao\classlibrary\www\Config::getConfig(\haibao\classlibrary\www\Config::CLASSLIBRARY_CONFIG_HOST_SAY));
		$this->assign('noteHost', \haibao\classlibrary\www\Config::getConfig(\haibao\classlibrary\www\Config::CLASSLIBRARY_CONFIG_HAIBAO_URL).'/notes/');
		$this->assign('appHost', \haibao\classlibrary\www\Config::getConfig(\haibao\classlibrary\www\Config::CLASSLIBRARY_CONFIG_HOST_APP));
		$this->generateHtml($path,$content);
		return $this->getHtml($path);
	}
}